/*
 * LexicalAnalyzer.h
 *
 *  Created on: 13/04/2009
 *      Author: evellyn, tamer, t�rsis
 */

#ifndef LEXICALANALYZER_H_
#define LEXICALANALYZER_H_
#include "Token.h"
#include <iostream>
#include <fstream>
#include <string>
#include <cctype>
#include <list>

using namespace std;

class LexicalAnalyzer {
private:
	// Source Code
	ifstream source;

	// The line which is being analyzed
	string line;

	// Keep the actual line of the source code
	int linePos;

	// Keep the actual column of the source code
	int columnPos;

	// Keep the actual position of the character which is been analyzed
	unsigned int controlPointer;

	// Token Table
	ofstream tableOfToken;

	Token token;

	list<Token> listOfTokens;

public:
	LexicalAnalyzer(string path);

	// Return the next character
	char getNext();

	// Analyzer all the source code to generate tokens
	list<Token> scan();

	// Skip all non-graphical character
	void skipSpace();



	/****** RETURN VALID LEXEMES FUNCTIONS ******/
	// Return a valid name
	string getName();

	// Return a valid digit
	string getDigit();

	// Return a valid operator
	string getOperator();

	// Return a valid delimiter
	string getDelimiter();

	// Return a valid constant sequence of character
	string getCharacterDelimiter();



	/****** TEST FUNCTIONS ******/
	// Test if actual character is a delimiter
	bool isDelimiter(char);

	// Test if actual character is an operator
	bool isOperator(char);

	// Test if actual character is the comment symbol
	bool isCommentSymbol(char);

	// Test if actual character is a character delimiter
	bool isCharacterDelimiter(char);


	void classification(int);

};

#endif /* LEXICALANALYZER_H_ */
